package main.java.handler;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @param <T>
 */
public abstract class AbstractListHandler<T> implements ResultSetHandler<List<T>>{

    @Override
    public List<T> handle(ResultSet rs) throws SQLException {
        List<T> rows = new ArrayList<T>();
        while (rs.next()){
            rows.add(getRow(rs));
        }
        return rows;
    }

    protected abstract T getRow(ResultSet rs) throws SQLException;
}
